package com.wb.oldwomen.module;

import com.wb.fw.Global;
import com.wb.oldwomen.GamePlayLayer;
import com.wb.oldwomen.Ioldwomam;
import com.wiyun.engine.nodes.Sprite;
import com.wiyun.engine.types.WYPoint;

public class HitControl implements Ioldwomam {
	static HitControl mHitControl;
	public static HitControl getInstance(GamePlayLayer parent) {
		if (mHitControl == null) {
			mHitControl = new HitControl(parent);
		}
		return mHitControl;
	}
	protected HitControl(GamePlayLayer parent) {
		mparent = parent;
		initHit();
	}
	GamePlayLayer mparent;
	Sprite[] mhits;
	private void initHit() {
		mhits = new Sprite[HIT_COUNT];
		for(int i=0;i<HIT_COUNT;i++) {
			mhits[i] = Sprite.make(HIT_DRAWABLE[i]);
			mhits[i].autoRelease();
			mhits[i].setVisible(false);
			mhits[i].setScale(Global.sScaleRate);
			mparent.addChild(mhits[i], Z_IGM_BTN);
		}
	}
	
	public void setHitVisible(boolean visible, int hit, WYPoint point) {
		mhits[hit].setVisible(visible);
		if (point != null)
			mhits[hit].setPosition(point);
	}
	
	public boolean isHitVisible(int hit) {
		return mhits[hit].isVisible();
	}
	
	public void update(float delta) {
		// TODO Auto-generated method stub
		
	}
}
